/**
 * 添加设备点检
 * author Luogan
 */
import React, { useEffect } from 'react'
import Plan from '../component/plan'
import KeepAlive from 'react-activation'
import { connect } from 'dva'

function Add({ location: { query }, dispatch, commonAction: { catchObj } }) {
  useEffect(() => {
    dispatch({
      type: 'commonAction/uploadCatch',
      payload: {
        catchObj: {
          deviceUpkeep_add: [true, false]
        }
      }
    })
  }, [dispatch])
  return (
    <KeepAlive name='deviceCheck_add' when={catchObj.deviceCheck_add}>
      <div className="deviceCheck_add">
        <Plan query={query} />
      </div>
    </KeepAlive>
  )
}
export default connect(({ commonAction }) => ({
  commonAction
}))(Add)